#coding=utf-8

print(r'\\\t\\')

print('''line1
line2
line3''')


a = 'ABC'
b = a
x = 'XYZ'
print(b) #得到的结果是'ABC'还是'XYZ'?


10 / 3 #精确除法，即使两个整数相除，得到的也是浮点数
10 // 3 #地板除，两个整数的相除，得到的也是整数
10 % 3 #取于运算


n = 123
f = 456.789
s1 = 'Hello, world'
s2 = 'Hello, \'Adam\''
s3 = r'Hello, "Bart"'
s4 = r'''Hello,
Lisa!'''


print('n =',123)
print('f =',456.789)
print('s1 =','Hello,world')
print('s2 =','Hello,\'Adam\'')
print(r'Hello,"Bart"')
print(r'''Hello,
Lisa!''')


s1 = 72
s2 = 85
r = (s2-s1)/s1 * 100
print( '小明的成绩提升了%.1f%%' %r)

#条件判断语句
#if语句执行有个特点，它是从上往下判断，如果在某个判断上是True，把该判断对应的语句执行后，就忽略掉剩下的elif和else

height = 1.75
weight = 80.5

bmi = weight/(height*height)
print(bmi)
if bmi < 18.5:
    print('过轻')
elif bmi <= 25:
    print('正常')
elif bmi <= 28:
    print('过重')
elif bmi <= 32:
    print('肥胖')
else:
    print('严重肥胖')


#循环
sum = 0
for x in range(101):
    sum = sum + x

print(sum)

#一百以内奇数之和
sum = 0
n = 99
while n > 0:
    sum = sum + n
    n = n - 2
print(sum)

'''
break 提前结束循环
continue 跳出本次循环，执行下一次循环
这两个语句通常都需要结合if语句使用
'''
